<?php
namespace app\console\controller;
use app\model\Article as SelfModel;
use app\model\ArticleType;

use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Request;
use think\facade\Route;
use think\facade\View;
use think\facade\Db;
use think\facade\Cache;
use think\facade\Cookie;
class Article extends Base
{



    public function initialize()
    {
        parent::initialize();
        $this->model = "\app\model\Article";
        $this->list_rows = 20;
        
    }
    public function select()
    {
            $article_type = ArticleType::where([['status', '=', 1]])->order([ 'id' => 'desc'])->select()->toArray();
            View::assign('article_type', $article_type);

    }

    public function add_data()
    {
        for ($i=0;$i<=50;$i++){
            $this->model::create(['title'=>'标题'.$i,'article_type_id'=>rand(1,4),'name'=>'name'.$i,'mobile'=>'mobile'.$i,'device_type'=>'device_type'.$i,'company_name'=>'company_name'.$i,'price'=>'price'.$i,'freight_fee'=>'freight_fee'.$i,'describe'=>'desc'.$i,'sort'=>100,'status'=>'status'.$i]);
        }
    }






}